<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:h="http://java.sun.com/jsf/html"
	  xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:p="http://primefaces.org/ui">

<h:head>
	<title>Manter Pessoa</title>
	<style>@IMPORT url("manterpessoa.css")</style>
</h:head>
	<h:body>
	
	
	<h:form id="form" >
		
			
		<h:panelGrid columns="3">  
			<p:commandButton value="Pesquisar" action="#{manterPessoa.pesquisar}"/>
			<p:commandButton value="Salvar" action="#{manterPessoa.salvar}" update="mensagem"/>
			<p:commandButton value="Limpar" action="#{manterPessoa.novo}" update="mensagem"/> 
	    </h:panelGrid>  
	    
		<p:messages id="mensagem"/>
		
		<p:panel id="panel" header="#{manterPessoa.textoTitulo}" style="width:40%"> 
			
			<h:panelGrid columns="2">  
	            <h:outputText id="labelNome" value="Nome: " />
	            <p:inputText  id="nome" value="#{manterPessoa.pessoa.nomeCompleto}"  maxlength="250" size="40"/>
	        </h:panelGrid>
	        
	        <h:panelGrid columns="4">  
	        
	        <h:outputText id="labelSexo" value="Sexo: " />
	            <p:selectOneMenu id="sexo" value="#{manterPessoa.pessoa.sexo}">  
	                <f:selectItem itemLabel="Selecione o sexo" itemValue="" />  
	                <f:selectItem itemValue="M" itemLabel="MASCULINO"  />
				   	<f:selectItem itemValue="F" itemLabel="FEMININO" /> 
	            </p:selectOneMenu>  
	            
	            <h:outputText id="labelCpf" value=" Cpf: " />
	            <p:inputText  id="cpf" value="#{manterPessoa.pessoa.cpfCnpj}"  maxlength="11" size="12"/>
	        </h:panelGrid>
		
	      	<h:panelGrid columns="2">
	            <h:outputText id="labelDataNascimento" value="Dt Nascimento: "/>
	            <p:calendar value="#{manterPessoa.pessoa.dataNascimento}" id="dataNascimento" showOn="button" pattern="dd/MM/yyyy"/>  
	   		</h:panelGrid>
	   		
	   		 <h:panelGrid columns="2">
	        	<h:outputText id="labelNaturalidade" value="Naturalidade: " />
	           		
	            <p:selectOneMenu id="naturalidade" value="#{manterPessoa.pessoa.naturalidade}">  
	                <f:selectItem itemLabel="" itemValue="" />
	                <f:selectItem itemValue="DOURADOS" itemLabel="DOURADOS"  />
				   	<f:selectItem itemValue="CAMPO_GRANDE" itemLabel="CAMPO GRANDE" /> 
				   	<f:selectItem itemValue="MARACAJU" itemLabel="MARACAJU" /> 
	            </p:selectOneMenu>  
	            
	      	</h:panelGrid>
	      	
	      	<p:tabView id="tabView" >
      			
      			<p:tab id="tabEndereco" title="Endereço" >
      				 <p:commandButton value="Novo" action="#{manterPessoa.novoEndereco}"/> 
      				 
      				 <p:dataTable id="dadosEndereco" var="e" value="#{manterPessoa.pessoa.dadosEndereco}" >  
      				 	
   				 		<p:column>  
				        	<table>
				        		<tr>
				        			<td>
				        				 <h:outputText value="Endereço " />  
				        			</td>
				        			<td>
				        				<h:outputText value="Número " /> 
				        			</td>
				        		</tr>
				        		<tr>
				        			<td>
				        				<p:inputText  id="endereco" value="#{e.endereco}"  maxlength="250" size="50"/>
				        			</td>
				        			<td>
				        				<p:inputText  id="numero" value="#{e.numero}"  maxlength="6" size="5"/>
				        			</td>
				        		</tr>
				        	</table>
				        	<table>
				        		<tr>
				        			<td>
				        				 <h:outputText value="Cep " />  
				        			</td>
				        			<td>
				        				<h:outputText value="Cidade " /> 
				        			</td>
				        			<td>
				        				<h:outputText value="Estado " /> 
				        			</td>
				        		</tr>
				        		<tr>
				        			<td>
				        				<p:inputText  id="cep" value="#{e.cep}"  maxlength="8" size="9"/>
				        			</td>
				        			<td>	
				        				 <p:selectOneMenu id="cidade" value="#{e.cidade}">  
							                <f:selectItem itemValue="DOURADOS" itemLabel="DOURADOS"  />
										   	<f:selectItem itemValue="CAMPO_GRANDE" itemLabel="CAMPO GRANDE" /> 
										   	<f:selectItem itemValue="MARACAJU" itemLabel="MARACAJU" /> 
							            </p:selectOneMenu>  
				        			</td>
				        			<td>	
				        				<p:selectOneMenu id="estado" value="#{e.estado}">  
							                <f:selectItem itemValue="MS" itemLabel="MS"  />
										   	<f:selectItem itemValue="SP" itemLabel="SP" /> 
										   	<f:selectItem itemValue="RJ" itemLabel="RJ" /> 
							            </p:selectOneMenu> 
				        			</td>
				        		</tr>
				        	</table>
				        </p:column> 
				    </p:dataTable> 
      			</p:tab>
      			
		      	<p:tab id="tabContato" title="Contatos" >  
		       
		        	<p:commandButton value="Novo" action="#{manterPessoa.novoContato}"/> 
		       		<p:dataTable id="dadosContato" var="d" value="#{manterPessoa.pessoa.dadosContato}" >  
				        <p:column>  
				        	
				        	<h:outputText value="Telefone: " /> 
				        	<p:selectOneMenu id="tipoTelefone" value="#{d.campo1}">  
				                <f:selectItem itemValue="COM" itemLabel="COMERCIAL"  />
							   	<f:selectItem itemValue="RES" itemLabel="RESIDENCIAL" /> 
							   	<f:selectItem itemValue="CEL" itemLabel="CELULAR" /> 
				            </p:selectOneMenu>  
						 </p:column> 
						 
						 <p:column> 	
				            <h:outputText value=" DDD: " />  
				            <p:inputText  id="ddd" value="#{d.campo2}"  maxlength="3" size="4"/>
				         </p:column> 
				         
				         <p:column>   
				            <h:outputText value=" Numero: " />  
				            <p:inputText  id="numero" value="#{d.campo3}"  maxlength="9" size="10"/>
				        </p:column>  
				    </p:dataTable>  
			    </p:tab> 
			</p:tabView> 
    		
		</p:panel>
	</h:form>
</h:body>
</html>
